import os

from openai import OpenAI

# DeepSeek的密钥
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
# DeepSeek的官网地址
DEEPSEEK_API_BASE_URL = "https://api.deepseek.com"


def call_deepseek():
    """
    调用DeepSeek大语言模型
    :return:
    """
    client = OpenAI(api_key=DEEPSEEK_API_KEY, base_url=DEEPSEEK_API_BASE_URL)

    response = client.chat.completions.create(
        model="deepseek-chat",
        messages=[
            {"role": "system", "content": "You are a helpful assistant"},
            {"role": "user", "content": "杭州是个风水宝地吗？"},
        ],
        stream=False
    )

    print(response.choices[0].message.content)


if __name__ == '__main__':
    call_deepseek()
